package entity;

import java.io.Serializable;

/**
 * Description：菜品类
 * Copyright (c), 2024, lbs
 * This program is protected by copyright laws.
 * Date： 2024年09月26日
 *
 * @author 刘宝顺
 * @version : 1.0
 **/
public class Dish implements Serializable {
    /**
     * 编号
     */
    private int no;

    /**
     * 名称
     */
    private String name;

    /**
     * 单价
     */
    private double price;

    /**
     * 点赞数
     */
    private int thumbsUpCnt;

    public Dish() {
    }

    /**
     * 构造方法
     *
     * @param no          编号
     * @param name        名称
     * @param price       单价
     * @param thumbsUpCnt 点赞数
     */
    public Dish(int no, String name, double price, int thumbsUpCnt) {
        this.no = no;
        this.name = name;
        this.price = price;
        this.thumbsUpCnt = thumbsUpCnt;
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getThumbsUpCnt() {
        return thumbsUpCnt;
    }

    public void setThumbsUpCnt(int thumbsUpCnt) {
        this.thumbsUpCnt = thumbsUpCnt;
    }

    /**
     * 重写从父类中继承过来的方法toString
     *
     * @return
     */
    @Override
    public String toString() {
        String no = String.valueOf(this.no);
        String name = this.name;
        String price = String.format("%.2f", this.price);
        String thumbNum = String.valueOf(this.thumbsUpCnt);
        String fmtAfterDishInfo = no + "\t\t" + name + "\t\t" + price + "元\t\t" + thumbNum;

        return fmtAfterDishInfo;
    }
}
